public class LogIn {
    public String account = "admin123";
    public String password = "123456";

    public void login1(String account,String password) throws AccountException,PasswordException{

        if (!this.account.equals(account)) {
            throw new AccountException("用户名输入错误，发生异常");
        }

        if (!this.password.equals(password)) {
            throw new PasswordException("密码输入错误，发生异常");
        }
        System.out.println("登录成功！");
    }

    public void login(String account,String password) /*throws AccountException,PasswordException*/{
        try {
            if (!this.account.equals(account)){
                throw new AccountException("用户名输入错误，发生异常");
            }
            if(!this.password.equals(password)){
                throw new PasswordException("密码输入错误，发生异常");
            }
        }catch (AccountException e){
            e.printStackTrace();
        }catch (PasswordException e){
            e.printStackTrace();
        }
        System.out.println("登录成功！");
    }


    public static void main(String[] args) throws AccountException, PasswordException {
        String account = "admin123";
        String password = "123456";
        LogIn login = new LogIn();
        login.login1(account,password);

    }
//    public static void main1(String[] args) {
//        String account = "admin123";
//        String password = "123456";
//
//        Login login1 = new Login();
//        login1.login(account,password);
//
//    }
}

